home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / RAND / T0501 / text0035.txt < prev    next >
Encoding:
Text File  |  1997-02-06  |  3.6 KB  |  73 lines

  1. I noticed a mail in here discussing the possibility of adding / replacing
  2. graphics in IWAD files themselves without the usual PWAD restrictions (floor
  3. tiles, sprites, samples etc).
  4.  
  5. Since Anthony is working on the WAD edit stuff, and I have a working knowledge
  6. of loading IWADs and processing them etc, I was thinking there might be a way to
  7. handle entire IWADs in a single PWAD for future versions of BM. Distributing
  8. truly custom levels on the PC is already made very difficult because of the
  9. problems PWAD files have with sprites and other data, so fixing this would be a
  10. great bonus.
  11.  
  12. As far as I can tell, the only reason PWAD files are possible in the first place
  13. is down to specific 'inconsistencies' with the way Doom keeps track of the
  14. resources themselves when loaded from disk and when organizing / preprocessing
  15. textures in memory etc.
  16.  
  17. The problem is that each resource 'type' (tile, picture, sample, sprite etc.)
  18. must be placed BETWEEN two special 'markers' in the IWAD file. Some example
  19. markers are as follows:
  20.  
  21. Patch graphics:    P_START,P_END
  22. Floor graphics:    F_START,F_END
  23. Sprites:        S_START,S_END
  24.  
  25. ..and so on for each 'type' of resource in the IWAD. The markers themselves are
  26. 0-byte files with no purpose other than to mark the beginning & end of a
  27. specific section.
  28.  
  29. If a resource of any given type is NOT found between the markers, there is a
  30. VERY good chance Doom will not recognise the resource and report it missing, or
  31. even crash.
  32.  
  33. So why do PWADs allow some types but not others? Well, for a start, there are a
  34. number of WAD entries which do not have markers, and tend to come at the start
  35. of the WAD. These include things like level data. However, PWAD files DO support
  36. wall textures - but NOT floor textures - UNLESS you include ALL floors at once!
  37.  
  38. The floors can be explained by the fact that unless you include ALL floors,
  39. along with the F_START & F_END markers, the data will be put in the wrong place,
  40. or will not overwrite the data in the original IWAD when patched into RAM. The
  41. result is either a disorganized set of floor tiles, or two copies of pretty much
  42. the same thing. Doom will not cope with this and will probably crash as a
  43. result. Sprites suffer the same way.
  44.  
  45. The only reason you can put new WALL textures in a PWAD is through sheer
  46. accident - there is a second directory entry called PNAMES which has a record of
  47. every patch graphic (wall texture fragment) in the WAD. No matter where the
  48. patches are stored, the Doom engine can still find them with this PNAMES
  49. directory - even if the patches don't fall between P_START & P_END. In other
  50. words, Doom uses an alternative method for keeping track of patch graphics - and
  51. ignores P_START & P_END for search operations.
  52.  
  53. So if Doom needed to pre-process it's sprites & floor textures before use, with
  54. the help of a SNAMES & FNAMES record list, as it already does with PNAMES for
  55. the walls - then we wouldn't have to worry about ?_START & ?_END rubbish and we
  56. could stick as much in the PWAD as we want by just fabricating new FNAMES &
  57. SNAMES resources and sticking them in the PWAD too. But we can't.
  58.  
  59. By making some simple modifications to the BM WAD handler, we can force BM to
  60. make use of home-made SNAMES & PNAMES directories to find all floor, wall,
  61. sprite & sample resources and therefore be able to ignore the start/end marker
  62. restrictions. These directories could even just be a list of names of all the
  63. new sprites or floors in the PWAD - you could ignore the names of those already
  64. in the IWAD.
  65.  
  66. If anyone want's to check this all out, refer to the Doomspec.txt guide on one
  67. of the FTP sites. This is where I get most of my information, although much of
  68. it is guesswork and experimentation.
  69.  
  70. Doug.
  71.  
  72.  
  73.